package com.firefighting.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.firefighting.dao.ProprietorConnectorMapper;
import com.firefighting.entity.ProprietorConnector;
@Service
public class ProprietorConnectorService
{
	@Autowired
	private ProprietorConnectorMapper proprietorConnectorMapper;
	
	/**
	 * @author zhyan
	 * @function 查询所有的业主联系人
	 * @date 2018.6.8
	 */
	@SuppressWarnings("rawtypes")
	public List<HashMap> queryAllProprietorConnector()
	{
		return proprietorConnectorMapper.selectAllProprietorConnector();
	}
	
	/**
	 * @author zhyan
	 * @function 根据业主联系人的id返回业主联系人详细信息
	 * @date 2018.6.8
	 */
	public ProprietorConnector queryProprietorConnectorById(int id)
	{
		return proprietorConnectorMapper.selectByPrimaryKey(id);
	}
	
	/**
	 * @author zhyan
	 * @function 删除业主联系人
	 * @date 2018.6.8
	 */
	public int deleteProprietorConnector(int id)
	{
		return proprietorConnectorMapper.deleteByPrimaryKey(id);
	}
	
	/**
	 * @author zhyan
	 * @function 添加业主联系人
	 * @date 2018.6.8
	 */
	public int insertProprietorConnector(ProprietorConnector record)
	{
		return proprietorConnectorMapper.insertSelective(record);
	}
	
	/**
	 * @author zhyan
	 * @function 更新业主联系人内容
	 * @date 2018.6.8
	 */
	/*public int updateProprietorConnector(ProprietorConnector record)
	{
		return proprietorConnectorMapper.insertSelective(record);
	}*/
	
	/**
	 * @author zhyan
	 * @function 根据业主id和联系人身份更新联系人信息
	 * @date 2018.6.10
	 */
	public int updateProprietorConnector(ProprietorConnector record)
	{
		return proprietorConnectorMapper.updateByProprietorIdAndIdentifySelective(record);
	}
	
	/**
	 * @author zhyan
	 * @function 根据业主id和联系人身份查询联系人信息
	 * @date 2018.6.10
	 */
	public ProprietorConnector queryByProprietorIDAndIdentify(int proprietorId, String identify)
	{
		return proprietorConnectorMapper.selectByProprietorIDAndIdentify(proprietorId, identify);
	}
	
	/**
	 * @author zhyan
	 * @function 根据业主id删除业主联系人
	 * @date 2018.6.15
	 * @return
	 */
	public int deleteByProprietorId(int id)
	{
		return proprietorConnectorMapper.deleteByProprietorId(id);
	}
}